package top.wilbert.collegelink.positionresume.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import top.wilbert.collegelink.positionresume.entity.PositionResumeEntity;
import top.wilbert.collegelink.positionresume.service.PositionResumeService;
import top.wilbert.collegelink.common.utils.PageUtils;
import top.wilbert.collegelink.common.utils.R;

import java.util.Arrays;
import java.util.Map;


/**
 * @author Augus
 * @email 2531496343@qq.com
 * @date 2022-12-23 20:02:17
 */
@RestController
@RequestMapping("positionresume/resumeposition")
public class PositionResumeController {
    @Autowired
    private PositionResumeService positionResumeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("subject:resumeposition:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = positionResumeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
//    @RequiresPermissions("subject:resumeposition:info")
    public R info(@PathVariable("id") Long id){
		PositionResumeEntity resumePosition = positionResumeService.getById(id);

        return R.ok().put("resumePosition", resumePosition);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
//    @RequiresPermissions("subject:resumeposition:save")
    public R save(@RequestBody PositionResumeEntity resumePosition){
		positionResumeService.save(resumePosition);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
//    @RequiresPermissions("subject:resumeposition:update")
    public R update(@RequestBody PositionResumeEntity resumePosition){
		positionResumeService.updateById(resumePosition);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
//    @RequiresPermissions("subject:resumeposition:delete")
    public R delete(@RequestBody Long[] ids){
		positionResumeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
